<?php

use yii\helpers\Html;
use yii\grid\GridView;

/* @var $this yii\web\View */
/* @var $searchModel backend\models\SearchCouponModel */
/* @var $dataProvider yii\data\ActiveDataProvider */
?>
<div class="coupon-model-index">


    <?php  echo $this->render('_search', ['model' => $searchModel]); ?>

    <p>
        <?php if (\backend\components\MenuHelper::checkRoute('create')){ echo Html::a('添加优惠券', ['create'], ['class' => 'btn btn-success']) ;  } ?>
    </p>
    <?= GridView::widget([
        'dataProvider' => $dataProvider,
        'columns' => [
            'name',
            'amount',
            'denomination',
            'count',
            ['attribute' =>'create_time','value' => function($model){
        return date('Y-m-d H:i:s',$model->create_time);
            }],

            [
                'class' => 'yii\grid\ActionColumn',
                'template' => \backend\components\MenuHelper::filterActionColumn('{update}')
            ],
        ],
    ]); ?>
</div>
